1 <html>
2 <head>
3         <title>Saledetails </title>
4         <style>
5
6             body {
7   margin:
0;
8   font-family: Arial, Helvetica, sans-serif;
9   background: #
484848;
10 }
11 .topnav {
12   overflow: hidden;
13   background-color: rgba(
249, 105, 14, 1);
14   height: 70px;
15   border: 3px solid #e69500;
16 }
17
18 .topnav a {
19   
float: left;
20   color: #f2f2f2;
21   text-align: center;
22   padding: 14px 16px;
23   text-decoration: none;
24   font-size: 35px;
25   font-weight: bold;
26 }
27 </style>
28 <body>
29 <div
class="topnav">
30             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
31             <a href=
"sales.php">Sales details</a>
32             
33           </div>
34 <?php
35
36 $servername =
"localhost";
37 $username =
"root";
38 $password =
"";
39 $dbname =
"Petshop_management";
40
41 // Create connection

42 $conn =
new mysqli($servername, $username, $password, $dbname);
43 // Check connection

44 if
($conn->connect_error) {
45     die(
"Connection failed: " . $conn->connect_error);
46 }

47 //echo
" CONNECTION ESTABLISHED \r\n";
48 //echo
" INSERTION IN PROCESS";
49 $id=$_POST[
"t1"];
50 $Query2=
"select count(*) from sales_details WHERE sd_id='$id'";
51 $Execute = mysqli_query($conn,$Query2);
52 $count = mysqli_fetch_row($Execute);

53 if
($count[0]==1)
54 {
55   $sql =
"DELETE FROM sales_details WHERE sd_id='$id'";
56   
if ($conn->query($sql) == TRUE) {
57       echo
'<div>
58       <h1 style=
"color:#f2f2f2;font-size:50px; font-family: "Roboto", sans-serif;margin:auto;">Data deleted successfully</h1>
59          </div>
';
60   }
else {
61       echo
"Error: " . $sql . "<br>" . $conn->error;
62   }
63 }

64 else
{
65   echo
'<div>
66   <h1 style=
"color:#f2f2f2;font-size:40px; font-family: "Roboto", sans-serif;margin:auto;"> Data not found</h1>
67      </div>
';
68 }
69
70
71
72 $conn->close();
73 ?>
74 <form>
75 <button type=
"submit" style=" height: 50px;width: 150px;cursor:pointer;border-radius:15px;
76 border: 3px solid #e69500;background-color: rgba(
249, 105, 14, 1);color:#f2f2f2;font-size:15px;" formaction="sales.php">back</button>
77 </form>
78 </body>
79 </html>


Gõ tìm kiếm nhanh...